/**
 * Bestpay.com.cn Inc.
 * Copyright (c) 2011-2020 All Rights Reserved.
 */
package com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.handler;

import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.AbstractLeaveHandler;
import com.suxiaoxiao.springbootlearn.designpattern.chianofresponsibilitypattern.LeaveRequest;

/**
 * 直接主管处理类
 *
 * @author zhaorongzhang
 * @version DirectLeaderLeaveHandler.java, v 0.1 2020/1/18 3:41 下午 zhaorongzhang Exp $$
 */
public class DirectLeaderLeaveHandler extends AbstractLeaveHandler {

    public DirectLeaderLeaveHandler(String handlerName) {
        this.handlerName = handlerName;
    }

    @Override
    public void handlerRequest(LeaveRequest leaveRequest) {
        if (leaveRequest.getLeaveDays() <= this.MIN) {
            System.out.println("直接主管:" + handlerName + ", 已处理; 流程结束。");
            return;
        }
        if (this.nextHandler != null) {
            this.nextHandler.handlerRequest(leaveRequest);
        } else {
            System.out.println("审批拒绝！");
        }
    }

}